/**
* @project admin-go-api
* @name osAndBrowser
* @descriptions os和browser和工具类
* @author 寒锋
* @date 2023-12-22 11:08:53
 */

package util

import (
	"github.com/gin-gonic/gin"
	useragent "github.com/wenlng/go-user-agent"
)

// GetOs 获取os
func GetOs(c *gin.Context) string {
	userAgent := c.Request.Header.Get("User-Agent")
	os := useragent.GetOsName(userAgent)
	return os
}

// GetBrowser 获取browser
func GetBrowser(c *gin.Context) string {
	userAgent := c.Request.Header.Get("User-Agent")
	os := useragent.GetBrowserName(userAgent)
	return os
}
